<template>
    <div> <strong>每日一句</strong>
          <h2>{{nowTime|formatDate}} {{nowWeek}}</h2>
          <p>
            &nbsp;&nbsp;&nbsp;&nbsp; {{content}}
          </p> </div>
</template>

<script>
import moment from 'moment'
import 'moment/locale/zh-cn'
export default {
  name: 'mryj',
  data () {
    return {
      nowTime: new Date(),
      content: '每日一句',
      nowWeek: moment().format('dddd') // 星期几
    }
  },
  created: function () {
    // 获取每日一句
    this.$axios.post(config.mryjHostUrl,
      'TransCode=030111&OpenId=123456789&Body=', {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded'
        }})
      .then(res => {
        if (res.status === 200) {
          this.content = res.data.ciba
        }
      }
      )
  },
  filters: {
    formatDate (time) {
      return moment(time).format('YYYY年MM月DD日')
    }
  }
}
</script>
<style scoped>

</style>
